<template lang="pug">
	.report-detail-container
		h4 化验单详情-{{name}}
		.describe {{assayReport.REPORT_TIME}}  {{hospName}}  {{assayReport.DEPT_NAME}}  {{assayReport.EMP_NAME_SEND}}
		.sub
			| 注：↑:高；↓:低；↑↑:高危；↓↓:低危；无标注，表示正常。
			br
			| 若有疑问，请与医院进行联系。
		table
			thead
				tr
					th 项目名称
					th 结果
					th 参考值
					th 单位
			tbody
				tr(v-for="item in assayReportDetail" :key="item.ASSAY_ITEM_CODE")
					td {{item.ASSAY_ITEM_NAME}}
					td(:class="{red:item.assayStatus.length}") {{item.RESULT}}{{item.assayStatus}}
					td {{item.REFRANGE}}
					td {{item.UNIT}}
</template>

<script>
export default {
	name: 'inspectDetail',
	data() {
		return {
			assayReport: '',
			assayReportDetail: '',
			queryvalue: '',
			org_code: '',
			querytype: '',
			name: '',
			hospName: ''
		}
	},
	created() {},
	mounted() {
		this.queryvalue = this.btoa(this.$route.query.queryvalue)
		this.org_code = this.btoa(this.$route.query.orgcode)
		this.querytype = this.btoa(this.$route.query.querytype)
		this.name = this.btoa(this.$route.query.name)
		this.hospName = this.btoa(this.$route.query.hospname)
		this.getListDetail()
	},
	methods: {
		getListDetail() {
			this.api.jtApi
				.getDetailList({
					querytype: this.querytype,
					queryvalue: this.queryvalue,
					org_code: this.org_code,
					name: this.name
				})
				.then(data => {
					if (data.ret_code === '0') {
						let assayreportdetail = this.tools.formatToArray(
							data.assayreportdetail
						)
						assayreportdetail.forEach(item => {
							let assayStatus = ''
							switch (item.RESULTSTATUS) {
								case 'N':
									assayStatus = ''
									break
								case 'P':
									assayStatus = '异常'
									break
								case 'H':
									assayStatus = '↑'
									break
								case 'L':
									assayStatus = '↓'
									break
								case 'HH':
									assayStatus = '↑↑'
									break
								case 'LL':
									assayStatus = '↓↓'
									break
								default:
									assayStatus = ''
									break
							}
							item.assayStatus = assayStatus
						})

						this.assayReport = data.assayreport
						this.assayReportDetail = assayreportdetail
						console.log(this.assayReport)
						console.log(this.assayReportDetail)
					}
				})
				.catch(() => {})
		}
	}
}
</script>

<style lang="stylus">
	.report-detail-container
		text-align center
		padding-top 40px
		h4
			font-size 36px
			font-weight normal
			color #6d6d6d
			margin 0
			line-height 1.5
		.describe,.sub
			color #9e9e9e
			margin 0 0 20px 0
		.describe
			line-height 2.5
			font-size 28px
		.sub
			line-height 50px
			font-size 24px
		table
			width 100%
			font-size 24px
			color #6d6d6d
			border-collapse collapse
			border-spacing 0
			border 1px solid #dcdcdc
			line-height 1.5
			tr
				display flex
				th,td
					flex 1
					padding 20px
					background-color white
					border 1px solid #dcdcdc
				th
					font-weight bold
				td
					&.red
						color #ff3b30
</style>
